﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QuanLyBanHang.OBJECT;
using System.Data.SqlClient;

namespace QuanLyBanHang.DAL
{
    static class DalDonViTinh
    {
        public static DataTable LoadUnit()
        {
            string sql = "select * from DonViTinh";
            DataTable dt = DataHelper.Load(sql);
            return dt;
        }
        public static int InsertUnit(ObjDonViTinh obj)
        {
            SqlParameter[] para = new SqlParameter[1];
            para[0] = new SqlParameter("TenDVT", obj.Ten);
            int thucthi = DataHelper.Update(para, "spInsertDonViTinh");
            return thucthi;
        }
        public static int UpdateUnit(ObjDonViTinh obj)
        {
            SqlParameter[] para = new SqlParameter[2];
            para[0] = new SqlParameter("MaDVT",obj.Ma);
            para[1] = new SqlParameter("TenDVT", obj.Ten);
            int thucthi = DataHelper.Update(para, "spUpdateDonViTinh");
            return thucthi;
        }
    }
}
